

let store = new Object()
export const defineStore = (builder) => {
    
    const res = builder()
    for (let item in res) {
        store[item] = res[item]
        if (typeof res[item] === 'function'){
            console.log("bind", item, res[item])
            store[item] = res[item].bind(store)
        }
    }

    return function() {
        return store
    }
}